<template>
	<view class="warp">
		<!-- #ifdef APP-PLUS -->
		<view class="title-contents"><view class="top-view status"></view></view>
		<!-- #endif -->
		<!-- 密码登录 -->
		<view class="login-phone form-wapper">
			<view class="phone input-wapper">
				<view class="lside"><text class="iconfont icon-shouji"></text></view>
				<view class="mobile rside"><input placeholder-class="input-placeholder" v-model="username" type="number" placeholder="请输入手机号" /></view>
			</view>
			<view class="phone input-wapper">
				<view class="lside"><text class="iconfont icon-yanzhengma"></text></view>
				<view class="mobile rside"><input placeholder-class="input-placeholder" v-model="vercode" type="number"  placeholder="请输入验证码" /></view>

				<view>
					<button type="default" @click="getSendSms()" >获取验证码</button>
				</view>
			</view>
			<view class="code input-wapper">
				<view class="lside"><text class="iconfont icon-mima2"></text></view>
				<view class="rside"><input placeholder-class="input-placeholder" v-model="password" type="password" maxlength="12"  placeholder="请设置新密码(6-12位) " /></view>
			</view>
		</view>

		<button type="primary" class="login-btn" @click="getForget()" >确定</button>
	</view>
</template>
<script>
import {getForget} from '@/api/user.js'
export default {
	data() {
		return {
			username:'',
			vercode:'',
			password:'',
		}
	},
	onLoad() {
		this.getForget();
	},
	methods:{
		getForget(){
			let username=uni.getStorageSync('username');
			let {password,vercode}=this
			getForget({username,password,vercode}).then(res=>{
				console.log(res);
			});
			// 返回
			setTimeout(() => {
				uni.navigateTo({
					url: '/pages/public/login'
				});
			}, 1000);
		},
		// 验证码
		getSendSms() {
			uni.$u.http.post('/user/sendSms',{
				mobile: this.username,
				type: 'login'
			}).then(res=>{
				console.log(res);
			})
		}
	}
}
</script>
<style lang="scss">
@import  "login.scss"
</style>
